package page;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;

public class App {
    public static void main(String[] args) throws Exception {
        System.out.println("Hello, World!");
        Employee emp =new Employee(1,"cao");
        emp.setAge(100);
        System.out.println("您的年龄是"+emp.getAge());
        System.out.println("日："+emp.getData().getDayOfMonth());
        Manager m =new Manager(1,"cao",100.100);



        //多态
        Employee e ;
        e = new Employee(1,"a");
        e = new Manager(25,"cao",15);
        e.setSalary(10.999);
        System.out.printf("输出多态 - 姓名: %s, 薪资: %f, 年龄: %d%n",
                e.getName(), e.getSalary(), e.getAge());


        Manager boss = new Manager(45,"boss",100);
        boss.setSalary(20);
        Employee[] stuff = new Employee[3];
        stuff[0]=boss;  //Manager
        e.setSalary(10);
        stuff[1]=e;    //Manager
        Employee e2 = new Employee(24,"zmm");
        e2.setSalary(2);
        stuff[2]=e2;
        for(Employee E :stuff){
            System.out.printf("输出多态2：--姓名：%s, 年龄：%d, 薪资: %f%n",E.getName(),E.getAge(),E.getSalary());
        }
        System.out.println(boss.toString());


        //list
        List<Employee> ll = new ArrayList<Employee>();
        ll.add(new Employee(22,"xiaomeimei"));
        ll.add(new Manager(22,"xiaozhuzhu",14));

        for (Employee el : ll){
            System.out.println(el);
        }

        //linklist
        List<Integer> lint = new LinkedList<Integer>();
        lint.add(1);
        lint.add(2);
        lint.add(3);
        for (Integer i : lint){
            System.out.printf("%d",i);
        }
        System.out.printf("%n");
    }
}
